import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-08
 * Time: 20:26
 */
public class Demo7 {
    private volatile static int isQuit = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while(isQuit == 0) {
                ;
            }
            System.out.println("线程 t1 结束");
        });

        t1.start();

        Thread t2 = new Thread(() -> {
            Scanner scanner = new Scanner(System.in);
            System.out.print("请输入isQuit的值：");
            isQuit = scanner.nextInt();
        });

        t2.start();
    }
}
